Skip to content

Audit the option and ptr types for proper integer usage #22294

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 6 commits into from
Feb 17, 2015

Conversation

nikomatsakis
Copy link
Contributor

cc #22240

@rust-highfive
Copy link
Contributor

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

/// assert_eq!(x.is_some(), true);
///
/// let x: Option<uint> = None;
/// let x: Option<usize> = None;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to leave these as usize rather than i32? (for pedagogy against using usize randomly)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these can actually be inferred if we want i32, although I dunno if that would "mess up" the quality of the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured the explicit types were there for a reason (in particular, type inference is hard on the reader, and these docs are largely targeting total newbies). In that case, I don't know that it matters what type is there. But I guess I can change it to u32 or i32.

@huonw
Copy link
Member

huonw commented Feb 13, 2015

Looks good, although there are a lot of examples using usize unnecessarily; it seems the only one that needs it is the example calling .len on a &String.

r=me all except that one are changed to u32 or something.

@nikomatsakis
Copy link
Contributor Author

@huonw updated the option examples and threw on a few more modules.

@huonw
Copy link
Member

huonw commented Feb 15, 2015

@bors r+ 6171 rollup

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 17, 2015
@bors bors merged commit 6171c35 into rust-lang:master Feb 17, 2015
@nikomatsakis nikomatsakis deleted the integer-audit branch March 30, 2016 16:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants